 <?php include('session.php'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Horarios</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">

    <script type="text/javascript" src="js/bootstrap-tab.js"></script>
    <script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tab.js"></script>
    <script type="text/javascript" language="javascript" src="js/ajax.js"></script> 
   

  </head>
  <body>
 
        <script src="http://code.jquery.com/jquery.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script type="text/javascript">
        </script>
        
          <nav class="navbar-wrapper navbar-default navbar-fixed-top" role="navigation">
            <div class="collapse navbar-collapse navbar-ex1-collapse">
              <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                       <li ><a href="ViewHome.php"><span class="glyphicon glyphicon-home"></span> Inicio</a></li>

                  <li><a href="ViewCarreras.php"><span class="glyphicon glyphicon-lock"></span> Carreras</a></li>

                  
                  <li class="dropdown">
                    <a href="ViewPerfiles.php" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-list-alt"></span> Perfiles</a>
                   <ul class="dropdown-menu" >
                    <li><a href="View_PA.php"><span class="glyphicon glyphicon-bookmark"></span> Perfil Acad&eacute;mico</a></li>
                    <li><a href="View_C.php"><span class="glyphicon glyphicon-book"></span> Perfil Curso</a></li>
                    <li><a href="#presupuesto" data-toggle="tab"><span class="glyphicon glyphicon-briefcase"></span> Perfil Presupuestarios</a></li> 
                  </ul>
                  </li>

                  <li><a href="ViewUsuarios.php"><span class="glyphicon glyphicon-user"></span> Usuarios</a></li>

                  <li class="active"><a href=""><span class="glyphicon glyphicon-calendar"></span> Horarios</a></li>

                  <li><a href=""><span class="glyphicon glyphicon-comment"></span> Reportes</a></li>

                  <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-asterisk"></span>
                      <ul class="dropdown-menu">
                        <li><a href="cerrarSesion.php">Salir</a></li>
                      </ul>
                    </li>
                  </ul>
            </div>
          </nav>
          <!--
          Se usa la de abajo para meter todo los forms.

          !-->


          <div class="container-fluid">
            <div class="jumbotron">
              <h3 class="text-success">Utilice este espacio para Crear Horarios.</h3>
              <a data-target="#periodo" data-toggle="modal">Periodo y sus Codigos</a>
              <br>
              <a id="detalles">Horarios</a>
                <?php
              //se abre este php para comentar.
              //el form siguiente es para crear los horarios.
               ?> 
               <center>     
                <form action='../Control/Horarios.php'>
                  
                  <table>
                    <tr>
                      <td><label for="codigo_ca"><h4>C&oacute;digo de Horario</h4></label></td>
                      <td><input type='text' name='V_codigo_ca' class="form-control" id="codigo_ca" placeholder="C&oacute;digo" style="width: 200px; padding: 2px" required/></td>
                      <td><a data-target="#popcodigos" data-toggle="modal"><span class="glyphicon glyphicon-filter"></td>
                    </tr>
                    <tr>
                      <td><label for="codigoCurso"><h4>Codigo Curso</h4></label></td>
                      <td><input type='text' name='V_codigo_curso' class="form-control" id="codigoCurso" placeholder="Codigo Curso" style="width: 200px; padding: 2px" required/></td>
                      <td><a data-target="#popCurso" data-toggle="modal"><span class="glyphicon glyphicon-filter"></span></a></td>
                    
                    
                      <td><label for="cedula"><h4>C&eacute;dula</h4></label></td>
                      <td><input type='text' name='V_cedula' class="form-control" id="cedula" placeholder="C&eacute;dula" style="width: 200px; padding: 2px" required/></td>
                      <td><a data-target="#pop"><span class="glyphicon glyphicon-filter"></span></a></td>          
                    </tr>
                    <tr>
                      <td>
                        <label for="aula"><h4>D&iacute;a</h4></label>
                      </td>
                      <td>
                        <select class="form-control">
                          <option value=0>Seleccione</option>
                          <option>Lunes</option>
                          <option>Martes</option>
                          <option>Miercoles</option>
                          <option>Jueves</option>
                          <option>Viernes</option>
                          <option>Sabado</option>
                        </select>
                      </td>
                    </tr>
                    <tr>
                      <td><label for="aula"><h4>Aula</h4></label></td>
                      <td><input type='text' name='V_aula' class="form-control" id="aula" placeholder="Aula" style="width: 200px; padding: 2px" required/></td>
                    </tr>
                    <tr>
                      <td><label for="hora"><h4>Hora</h4></label></td>
                      <td><input type='text' name='V_hora' class="form-control" id="hora" placeholder="Hora" style="width: 200px; padding: 2px" required/></td>
                    </tr>
                    <tr>
                      <td></td>
                      <td>   
                        <button type="submit" class="btn btn-primary" id="" name='ca_det_Crear'  title="Crear">
                          <span class="glyphicon glyphicon-ok"></span> 
                        </button>
                        <button type="reset" class="btn btn-primary" id="" title="Cancelar Accion">
                          <span class="glyphicon glyphicon-remove"></span> 
                        </button>
                      </td>
                    </tr>
                  </table>
                </form>
              </center>
            </div>

            <?php
            //Area de popup´s Abajo
             ?>
        
            

               <div class="modal fade" id="popCurso">
               <div class="modal-dialog">
                 <div class="modal-content">
                   <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <h4 class="modal-title">Seleccione el curso</h4>
                   </div>
            
                   <div class="modal-body">
                    <?php
                        include('../Model/ModelConexion.php');
                        $conexion = new Conexion();
                        $consulta_carrera = $conexion->Consulta("
                          SELECT codigo,nombre  
                          FROM carreras 
                          ORDER BY nombre
                          ");
                     ?>
           
                     <form name="formcarreras" action="Verdetalles.php" method="POST">
                      <div>
                        <a href=""></a>
                      <select name="carrera" id="carrera" onchange="from(document.formcarreras.carrera.value,'midiv','Filtro_Carrera.php')">
                        <option value="0">Seleccione</option>
                        <?php while($fila=$conexion->Arreglo($consulta_carrera)){ ?>
                          <option value="<?php echo $fila['codigo']?>"><?php echo $fila['nombre']?></option>
                        <?php }?>
                              
                      </select> 
                      </div>
                        <div id="midiv">
                
                        </div>
                        <div id="midiv1">
                          
                        </div>
                     </form>

                             
                   </div>

                   <div class="modal-footer">
                     <button type="button" class="btn btn-default" data-dismiss="modal">Listo</button>
                     
                   </div>
                 </div><!-- /.modal-content -->
               </div><!-- /.modal-dialog -->
             </div><!-- /.modal -->
              






              <!-- /.el de crear enc_horararios -->
             <div class="modal fade" id="periodo">
               <div class="modal-dialog">
                 <div class="modal-content">
                   <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <h4 class="modal-title">Creacion de codigos</h4>
                   </div>
            
                   <div class="modal-body">
                   <form action='../Control/Horarios.php' method='POST' class="form-horizontal">
                  <br>
                  <table>
                    <tr>
                      <td><label class="col-lg-3 control-label" id="lblanno" for="CodigoCarrera"><h4>A&ntilde;o:</h4></label>
                      <select name='V_anno' id="selectanno" class="form-control" style="width: 200px; padding: 2px">
                            <?php
                            //for para combo box de año.
                            $hoy = date("Y"); 
                            $dentrode5anos = $hoy + 5;
                              for ($i=$hoy; $i <=$dentrode5anos ; $i++) {?>

                              <option value="<?php echo $i?>"><?php echo $i?></option>
                              <?php }
                             ?>                
                        </select>
                      </td>

                    </tr>
                    <tr>
                      <td><label class="col-lg-3 control-label" id="lblperiodo" for="CodigoCarrera"><h4>Periodo: </h4></label>
                       <select name="V_periodo" class="form-control" id="selectperiodo" style="width: 200px; padding: 2px">
                         <option value="1">I Ciclo</option>
                         <option value="2">II Ciclo</option>
                       </select>
                      </td>

                          </tr>
                          <tr>
                            <td>   
                              <center><button type="submit" class="btn btn-primary" id="btnca" name='ca_enc_Crear'  title="Agregar">
                                <span class="glyphicon glyphicon-ok-sign"></span> 
                              </button></center>
                              
                            </td>

                          </tr>
                        </table>
                      </form>
                    </div>

                   <div class="modal-footer">
                     <button type="button" class="btn btn-default" data-dismiss="modal">Listo</button>
                     
                   </div>
                 </div><!-- /.modal-content -->
               </div><!-- /.modal-dialog -->
             </div><!-- /.modal -->
                      
                                  






          <div class="modal fade" id="popcodigos">
               <div class="modal-dialog">
                 <div class="modal-content">
                   <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <h4 class="modal-title">Seleccione el codigo</h4>
                   </div>
            
                   <div class="modal-body">
                  <?php
                    echo '<table id="tablaca" border=2 style="width: 300px;" class="table table-striped">'; 
                    echo "<tr>"; 
                    echo "<td ><b>Ciclo</b></td>"; 
                    echo "<td style='width: 100px;'><b>Del</b></td>";
                    echo "<td ><b>Utilice este codigo</b></td>";
                    echo "</tr>"; 
                      $ann= Date("Y");

                  $consulta = $conexion->Consulta("
                    SELECT codigoHorario,periodo,anno FROM caencabezado
                    WHERE anno >= '$ann'
                    ORDER BY anno
                  ");

                      if($conexion->numero_filas($consulta) > 0)
                    { 
                      while ($Busca_codigo_ca= $conexion->Arreglo($consulta))
                      {
                        echo "<tr>";                    
                        echo "<td valign='top'>" .( $Busca_codigo_ca['periodo']) . "</td>";
                        echo "<td valign='top'>" .( $Busca_codigo_ca['anno']) . "</td>";
                        echo "<td valign='top'>" .( $Busca_codigo_ca['codigoHorario']) . "</td>";
                        //echo "<td valign='top' id='cod'>" .( $Busca_codigo_ca['codigoHorario']) . " <input type='button' data-clipboard-target='cod' class='btn' value='Copiar' onClick='JavaScript: copy_clipboard(document.getElementById('cod').value)'></td>";
                       
                      }
                    }
                    else
                    {
                      echo "No hay informacion aun";
                    }
                        
                      echo "</table>";  
                   ?>

                             
                   </div>

                   <div class="modal-footer">
                     <button type="button" class="btn btn-default" data-dismiss="modal">Listo</button>
                     
                   </div>
                 </div><!-- /.modal-content -->
               </div><!-- /.modal-dialog -->
             </div><!-- /.modal -->


        <?php include("footer.php");?>
            
              
                
               
              
              

                    
      
  
  
  </body>
</html>